<?php

require_once './config.php';

$c = mysql_connect(HOST, USER, PWD) or die("Connexion impossible au serveur");
mysql_select_db(DB) or die("Impossible de se connecter à la base de données");

$name = $_POST['name'];
$value = addslashes($_POST['value']);
$pk = $_POST['pk'];

$sql = "UPDATE newsletter SET $name = '$value' WHERE id = $pk";

$result = mysql_query($sql) or die(mysql_error());

$count = mysql_affected_rows();

if($count){
    echo "Mise à jour avec succes\n$sql";
}else{
    echo "Erreur\n$sql";
}